//
//  EpointUploadMobileErrorLogTask.m
//  EpointFrame5
//
//  Created by 李亚春 on 14-2-11.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "EpointUploadMobileErrorLogTask.h"

@implementation EpointUploadMobileErrorLogTask

-(void)execute
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSString *userguid = [userDefaults objectForKey:Epoint_User_UserGuid];
    NSString *ERRORLog = [DBFrameService getSingErrorLog];
    if (ERRORLog.length==0) {
        return;
    }
    NSString *Epoint_MobileManager_URL = NSLocalizedString(@"Epoint_MobileManager_URL", @"");
    NSString *managerNS = @"http://server.service.axis2";
    NSString *idfv =[[[UIDevice currentDevice] identifierForVendor]UUIDString];
    EpointWebServiceUtil *ws = [[EpointWebServiceUtil alloc]initWithUrl:Epoint_MobileManager_URL namespace:managerNS method:@"uploadMobileLog"];
    [ws addParameterForString:@"userguid" value:userguid];
    [ws addParameterForString:@"DeviceModel" value:[UIDevice currentDevice].model];
    [ws addParameterForString:@"manufacturer" value:@"Apple"];
    [ws addParameterForString:@"systemname" value:[UIDevice currentDevice].systemName];
    [ws addParameterForString:@"systemversion" value:[UIDevice currentDevice].systemVersion];
    [ws addParameterForString:@"appname" value:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]];
    [ws addParameterForString:@"appversion" value:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
    
    ERRORLog = [EpointStringUtil filterXmlString:ERRORLog];
    
    [ws addParameterForString:@"errorlog" value:ERRORLog];
    [ws addParameterForString:@"deviceid" value:idfv];
    [ws addParameterForString:@"displayname" value:(NSString *)[DBFrameService getUserDefaults:Epoint_User_DisplayName]];
    NSString *bs = ws.start;
    NSLog(@"%@",bs);
}

@end
